<template>
	<view>
		<view style="margin-top: 10rpx;background: #EEEEEE;" class="content">
				<view class="row">
					<view class="row_logo">
						<image src="../../../static/pankesearch.png" mode=""></image>
					</view>
					<view class="row_right">
						 <input v-if="showSearch" class="uni-input"  v-on:blur="searchFriend" v-bind:value="username" name="input" placeholder="简客号/邮箱/手机号" />
					</view>
				</view>
				
				
				
		 </view>
		 
		 <view class="content">
		 	<view @click="gotoPage('/pages/index/find/pyq/pyq')">
		 		<view class="row">
		 			<view class="row_logo">
		 				<image src="../../../static/phoneperson.png" mode=""></image>
		 			</view>
		 			<view class="row_right" style="display: flex;">
		 				<text>手机联系人</text>
		 				<image class="icon_right" src="../../../static/right.png" mode=""></image>
		 			</view>
		 		</view>
				
				<view class="row">
					<view class="row_logo">
						<image src="../../../static/scan.png" mode=""></image>
					</view>
					<view class="row_right">
						<text>扫一扫</text>
						<image class="icon_right" src="../../../static/right.png" mode=""></image>
					</view>
				</view>
		 	</view>
		 	
		 	
		
		 	
		 	
		 </view>
		
	
	     <view style="margin-top: 10rpx;">
	     	<button @click="searchFriendB" type="primary" style="padding-left: 10rpx;">搜索</button>
	     </view>
	
	</view>
	
</template>

<script>
	import http from '../../../common/request.js'
	export default {
		data() {
			return {
				username:undefined,
				showSearch:true
			}
		},
		methods: {
			searchFriend(e){
				let username = e.detail.value
				this.username = username
				if(''==username){
					uni.showToast({
						title:'搜索不能为空'
					})
				}else{
					this.search(username)
					
				}
			},
			searchFriendB(){
				this.search(this.username)
			},
			
			async search(username) {
					const res = await http.request({
						url: '/sys_user/search_friend?username='+username,
						method:'POST',
						data:{}
					})
					if(res.data.data.code==0){
						console.log(res.data.data)
						uni.navigateTo({
							url:'./show_friend?uid='+res.data.data.data.id
						})
					}else{
						uni.showToast({
							title:res.data.data.message
						})
					}				
			},
			
		}
	}
</script>

<style lang="scss">
page {
   }
   .line{
   	width: 100%;
   	height: 10px;
   }
   .assistant_ly{
     text-align: left;
     display:flex;
     flex-direction:column;
     border-radius: 50rpx;
     background-color: white;
     justify-content: center;
   }


	.line{
		width: 100%;
		height: 10px;
	}
	.row {
		background: white;
		display: flex;
		width: 100%;
		height: 50px;

		.row_logo {
			width: 18%;
			display: flex;
			align-items: center;

			image {
				width: 32px;
				height: 32px;
				margin: auto;
				border-radius: 5px;
			}
		}

		.row_right {
			position: relative;
			height: 100%;
			width: 84%;
			display: flex;
			align-items: center;

			border: {
				bottom: 1px solid #DDDDDD;
			}

			text {
				font-size: 16px;
				font-family: 'syht';
				display: block;
			}
			.icon_right{
				position: absolute;
				right: 10px;
				width: 15px;
				height: 15px;
				opacity: .5;
			}

		}



	}

	.row:last-child {
		.row_right {
			border: 0;
		}
	}
</style>
